{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tensorflow import keras\n",
    "from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense\n",
    "from tensorflow.keras.models import Sequential\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "fashion_mnist = keras.datasets.fashion_mnist\n",
    "(train_images, train_labels),(test_images, test_labels) = fashion_mnist.load_data()\n",
    "\n",
    "class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', \n",
    "               'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = Sequential([\n",
    "    Conv2D(\n",
    "        filters = 32,\n",
    "        kernel_size = (5,5),\n",
    "        strides = 1,\n",
    "        padding = 'same',\n",
    "        activation = 'relu',\n",
    "        input_shape = (28, 28, 1)\n",
    "    ),\n",
    "    MaxPooling2D(\n",
    "        pool_size = (2,2),\n",
    "        strides = 2,\n",
    "        padding = 'same'\n",
    "    ),\n",
    "\n",
    "    Conv2D(\n",
    "        filters = 64,\n",
    "        kernel_size = (5,5),\n",
    "        strides = 1,\n",
    "        padding = 'same',\n",
    "        activation = 'relu'\n",
    "    ),\n",
    "    MaxPooling2D(\n",
    "        pool_size = (2,2),\n",
    "        strides = 2,\n",
    "        padding = 'same'\n",
    "    ),\n",
    "\n",
    "\n",
    "    Flatten(),\n",
    "    Dense(\n",
    "        units = 512,\n",
    "        activation = 'relu'\n",
    "    ),\n",
    "    Dense(\n",
    "        units = 10,\n",
    "        activation = 'softmax'\n",
    "    )\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.compile(\n",
    "    optimizer = keras.optimizers.SGD(lr=1e-4, decay=1e-6),\n",
    "    loss = 'sparse_categorical_crossentropy',\n",
    "    metrics = ['accuracy']\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/1\n",
      "60000/60000 [==============================] - 76s 1ms/step - loss: 0.9090 - acc: 0.7702\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x7fd2d9fffd30>"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#训练模型\n",
    "#Conv2D作为第一层，fit中x参数应该为（samples，width，height，channels）\n",
    "#loss取“sparse_categorical_crossentropy”，fit中y参数应该为(1,2,0,...)\n",
    "#loss取“categorical_crossentropy”，fit中y参数应该为one-hot encodings\n",
    "X_train = train_images[:,:,:,np.newaxis]\n",
    "model.fit(X_train, train_labels, epochs = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000/10000 [==============================] - 4s 351us/step\n",
      "test_loss:  0.5829290775299072\n",
      "test_accuracy:  0.8058\n"
     ]
    }
   ],
   "source": [
    "#测试集评估\n",
    "#Conv2D作为第一层，evaluate中x参数应该为（samples，width，height，channels）\n",
    "X_test = test_images[:,:,:,np.newaxis]\n",
    "test_loss, test_accuracy = model.evaluate(X_test, test_labels, batch_size = 128)\n",
    "print(\"test_loss: \", test_loss)\n",
    "print(\"test_accuracy: \", test_accuracy)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [],
   "source": [
    "#预测\n",
    "predictions = model.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Visualization code\n",
    "def plot_image(i, predictions_array, true_labels, img):\n",
    "    prediction_array, true_label, img = predictions_array[i], true_labels[i], img[i]\n",
    "    plt.grid(False)\n",
    "    plt.xticks([])\n",
    "    plt.yticks([])\n",
    "    \n",
    "    plt.imshow(img, cmap = plt.cm.binary)\n",
    "    \n",
    "    predicted_label = np.argmax(prediction_array)\n",
    "    if predicted_label == true_label:\n",
    "        color = 'blue'\n",
    "    else:\n",
    "        color = 'red'\n",
    "    plt.xlabel(\n",
    "        \"{} {:2.0f}% ({})\".format(\n",
    "        class_names[predicted_label],\n",
    "        100*np.max(prediction_array),\n",
    "        class_names[true_label]\n",
    "    )\n",
    "        , color = color)\n",
    "\n",
    "def plot_value_array(i, predictions_array, true_labels):\n",
    "    prediction_array, true_label = predictions_array[i], true_labels[i]\n",
    "    plt.grid(False)\n",
    "    plt.xticks(range(10), class_names, rotation = 90)\n",
    "    plt.yticks([])\n",
    "    \n",
    "    thisplot = plt.bar(range(10), prediction_array, color = \"blue\")\n",
    "    plt.ylim([0,1])\n",
    "    predicted_label = np.argmax(prediction_array)\n",
    "    \n",
    "    thisplot[predicted_label].set_color('red')\n",
    "    thisplot[true_label].set_color('blue')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAADxCAYAAAD8x81kAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xm83EWZ7/HPkwTIvrMFkKAmAgoEDIwsIpvMAAN3GFBAroOjL0RxRODOgOPCMshFUGacywiMbCKyXSAoy5UEkC2BAAlkg7B5SRjZEyAbYUl45o+qTvp016/7133Oyakk3/frdV6erq7q36878pzqqqeqzN0REZGe16unb0BERAIFZBGRTCggi4hkQgFZRCQTCsgiIplQQBYRyYQCsohIJhSQRUQyoYAsIpK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QmCC\n",
      "text/plain": [
       "<Figure size 432x216 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Visualization show\n",
    "i = 0\n",
    "plt.figure(figsize=(6,3))\n",
    "plt.subplot(1,2,1)\n",
    "plot_image(i, predictions, test_labels, test_images)\n",
    "plt.subplot(1,2,2)\n",
    "plot_value_array(i, predictions, test_labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
